Module pyglet.image.atlas

Group multiple small images into larger textures.

This module is used by pyglet.resource to efficiently pack small images into larger textures. TextureAtlas maintains one texture; TextureBin manages a collection of atlases of a given size.

Example usage:

# Load images from disk
car_image = pyglet.image.load('car.png')
boat_image = pyglet.image.load('boat.png')

# Pack these images into one or more textures
bin = TextureBin()
car_texture = bin.add(car_image)
boat_texture = bin.add(boat_image)

The result of TextureBin.add is a TextureRegion containing the image. Once added, an image cannot be removed from a bin (or an atlas); nor can a list of images be obtained from a given bin or atlas -- it is the application's responsibility to keep track of the regions returned by the add methods.

Since: pyglet 1.1

Classes

  AllocatorException
The allocator does not have sufficient free space for the requested image size.
  Allocator
Rectangular area allocation algorithm.
  TextureAtlas
Collection of images within a texture.
  TextureBin
Collection of texture atlases.

Variables

  __package__ = 'pyglet.image'